package cn.rongdao.jrkabao.ui.main.mainfragment;

import android.view.View;

import com.mifengkong.frtools.http.request.event.CompulsoryDownLineEvent;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import butterknife.BindView;
import cn.rongdao.jrkabao.R;
import cn.rongdao.jrkabao.base.BaseViewPagerFragment;
import cn.rongdao.jrkabao.ui.remind.uicomponent.RemindUIComponent;
import cn.rongdao.jrkabao.util.LoginUtil;

/**
 * Created by jack on 2017/9/8
 */

public class FragmentRemind extends BaseViewPagerFragment {

    @BindView(R.id.lr_ll_main)
    RemindUIComponent remindUIComponent;

    @Override
    protected int layoutRes() {
        return R.layout.layout_remind;
    }

    @Override
    protected void onViewReallyCreated(View view) {
        super.onViewReallyCreated(view);
        EventBus.getDefault().register(this);
    }

    @Override
    protected void lazyLoad() {
        remindUIComponent.initPtr(this);
    }

    @Subscribe(threadMode = ThreadMode.MAIN) //在ui线程执行
    public void compulsoryDownLineMessage(CompulsoryDownLineEvent compulsoryDownLineEvent) {
        LoginUtil.logout(getContext());
    }

    @Override
    public void onDestroy() {
        remindUIComponent.onDestroy();
        EventBus.getDefault().unregister(this);
        super.onDestroy();
    }
}